﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AppFramework.Migrations
{
    public partial class CreateTbQualityTesting_ReportOfWorker : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "tb_QualityTesting",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    QualityNumber = table.Column<int>(type: "int", maxLength: 50, nullable: false),
                    QualityInspectionQuantity = table.Column<int>(type: "int", nullable: false),
                    QualifiedQuantity = table.Column<int>(type: "int", nullable: false),
                    UnQualifiedQuantity = table.Column<int>(type: "int", nullable: false),
                    ReportWorkerNumber = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    MemberId = table.Column<int>(type: "int", nullable: false),
                    QualityInspectionPersonnel = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_QualityTesting", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_ReportOfWorker",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ReportWorkerNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    OrderCount = table.Column<int>(type: "int", nullable: false),
                    WorkNumber = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    MemberId = table.Column<int>(type: "int", nullable: false),
                    ReprotWorkerName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_ReportOfWorker", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_tb_QualityTesting_QualityNumber_ReportWorkerNumber",
                table: "tb_QualityTesting",
                columns: new[] { "QualityNumber", "ReportWorkerNumber" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_ReportOfWorker_WorkNumber_ReportWorkerNumber",
                table: "tb_ReportOfWorker",
                columns: new[] { "WorkNumber", "ReportWorkerNumber" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "tb_QualityTesting");

            migrationBuilder.DropTable(
                name: "tb_ReportOfWorker");
        }
    }
}
